<template>
  <div>
    <el-dialog title="选择商品" :visible.sync="log_shop" width="700px">
      <div>
        <div class="flex">
          <el-input v-model="shopsearch.title" style="width: 180px; margin-right:20px;" placeholder="请输入商品名称"></el-input>
          <el-input v-model="shopsearch.fetch_code" style="width: 180px; margin-right:20px;" placeholder="请输入商品编码"></el-input>
          <el-button type="danger" @click="getshops()">搜索</el-button>
        </div>
        <div style="height: 600px; overflow: auto;">

          <div class="flexbc" v-for="item in shoplists" :key="item.id" style="border: 1px #eaeaea solid; padding:10px 20px; margin-top:10px;">
            <div class="flexc">
              <div style="margin-right: 20px;">
                <img :src="item.image1" style="width: 100px; height:100px;">
              </div>
              <div style="margin-right: 20px;">
                <div style="margin-bottom: 10px; font-weight: bold;">{{item.title}}
                  <el-button type="warning" style="margin-left: 20px;" size="mini" v-if="item.take_number == 1 && item.mobile_config == 1">归属地选号</el-button>
                  <el-button type="warning" style="margin-left: 20px;" size="mini" v-if="item.take_number == 1 && item.mobile_config == 2">支持选号</el-button>
                </div>
                <div style="margin-bottom: 10px;">编码：{{item.fetch_code}}</div>
                <div style="margin-bottom: 10px;">创建时间：{{item.created_at}}</div>
              </div>
            </div>

            <div>
              <el-button type="danger" @click="xuanzhong(item)">选择商品</el-button>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="log_shop = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

  import axios from "axios";
  export default {
    name: 'xuanzeheyinyongshangpin',
    data() {
      return {
        log_shop:false,
        shopsearch:"",
        shoplists:""
      }
    },
    created() {
      this.getlist()
      
    },
    methods:{
      

      getshops: function() {
      	axios.get(`${this.apis}/api/order-page/list`,{
          params:this.shopsearch
        })
      		.then(response => {
      			if (response.data.msg.code == 0) {
      				this.shoplists = response.data.data
      			} else {
      				this.$message.error(response.data.msg.info);
      			}
      		})
      },
    }
  }
</script>

<style lang="less" scoped>

</style>
